With the popularity of mobile terminals, there is an ever increasing number of application programs operated in mobile terminals in order to provide more services to users. Generally, a user may run multiple application programs at the same time while using a mobile terminal, which increases the burden of a memory of the mobile terminal to access instructions and data.
Currently, a virtual memory mechanism is applied to the mobile terminal, so as to increase a visible size of a main memory or a Random Access Memory (RAM) of the main memory. That is, a storage area, known as an auxiliary memory or a secondary memory, in a non-volatile memory including a hard disk, a USB or Flash memory, is employed to backup the RAM. In this way, virtual address spaces are added to the physical RAM. The virtual address space is generally divided into plurality of page frames which are accessible by a processor. A Memory Management Unit (MMU) provides a mechanism to convert a virtual address from processes running in a processor into a physical page of instructions or data required by the processes. If there is a lack of a physical page, instructions or data required by the system are invoked from an external memory to a physical page in a main memory, and the physical page is mapped to the virtual address. If the replaced physical page is modified, the physical page can be stored. Such a technology is called Demand Paging, which is originally applied in a UNIX system.
FIG. 1 is a schematic structural diagram of a common type of mobile terminal. Referring to FIG. 1, the mobile terminal 1 includes a controller 10, an external auxiliary memory 11 and an external memory 12 configured outside the controller 10 of the mobile terminal 1, all of which are coupled together via a bus 13. The controller 10 further includes a central processing unit (CPU) 101, a direct access memory controller (DAMC) 102, a memory management unit (MMU) 103 and an internal memory 104, all of which are also coupled together via the bus 13.
Specifically, when the CPU executes a program which normally includes a plurality of processes, through the DMAC 102, the CPU can access physical pages of the instructions or data required by the processes which are stored in the internal memory 104. If the internal memory 104 is lack of physical pages to run programs, the CPU can invoke the instructions or data required by the processes from the external auxiliary memory 11 to a physical page in the internal memory 104, and the physical page is mapped to the virtual address. Specifically, the MMU 103 provides mechanism of converting a virtual address from processes running in the CPU 101 into a physical page of the instructions or data required by the processes.
Further, in order to save storage spaces in the external auxiliary memory 11, a part of instructions or data of programs are stored in a compressed format. When the CPU 101 needs to read a compressed file, firstly, it is needed to decompress the compressed file using a decoding program (not shown) configured outside the controller 10. Typically, the decompressed file is stored in the external memory 12. Then, instructions or data in the decompressed file are acquired according to mapping and conversion between the virtual address provided by the MMU 103 and the physical address of the external memory 12, and programs are operated based on the decompressed file.
However, in operating a program in a mobile terminal described above, the decoding program configured outside the controller 10 has a slow decompressing speed, and the decompressed file is not stored in an internal memory inside the controller, which thereby lead to a resource waste of the internal memory, and a low speed of the CPU to operate the decompressed file.
More information relating to demand paging may refer to U.S. Pat. No. 7,617,381B2 which discloses a demand paging apparatus and method for embedded system. However, the disclosure does not solve the above problems.